package com.enjoy.controller;

import com.enjoy.common.Result;
import com.enjoy.service.FileOperateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author 姜风
 * @date 2021/9/8 9:52
 */
@RestController
@RequestMapping("/fileOperate")
public class FileOperateController {

    @Autowired
    private FileOperateService fileOperateService;

    /**
     * 文件上传
     *
     * @param file 文件
     * @return 返回成功标识
     */
    @RequestMapping(value = "/storage", method = RequestMethod.POST)
    public Result storage(@RequestBody MultipartFile file) {
        return fileOperateService.storageFile(file);
    }

}
